﻿@{
    ViewData["Title"] = "单点登录系统";
    Layout = null;
}
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>@ViewData["Title"]</title>
    <link href="~/layui/css/layui.css" rel="stylesheet" />
</head>
<style>
    body {
        overflow: hidden;
    }

    .login {
        height: 260px;
        width: 260px;
        padding: 20px;
        background-color: rgba(0,0,0,0.5);
        border-radius: 4px;
        position: absolute;
        left: 50%;
        top: 50%;
        margin: -150px 0 0 -150px;
        z-index: 99;
    }

        .login h1 {
            text-align: center;
            color: #fff;
            font-size: 24px;
            margin-bottom: 20px;
        }

    .form_code {
        position: relative;
    }

        .form_code .code {
            position: absolute;
            right: 0;
            top: 1px;
            cursor: pointer;
        }

    .login_btn {
        width: 100%;
    }

    .bg-image {
        background-image: url('/image/login.jpg');
        width: 100%;
        height: 100%;
        position: fixed;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        -moz-background-size: 100% 100%;
    }
</style>
<body>
    <div class="bg-image"></div>
    <div>

    </div>
    <div class="login">
        <h1>单点登录系统</h1>
        <form id="login-form" class="layui-form" method="post" action="/Account/Login">
            <div class="layui-form-item">
                <input class="layui-input" name="username" placeholder="用户名" lay-verify="required" autocomplete="off" type="text">
            </div>
            <div class="layui-form-item">
                <input class="layui-input" name="password" placeholder="密码" lay-verify="required" autocomplete="off" type="password">
            </div>
            <button class="layui-btn login_btn" lay-submit="" lay-filter="btn_login">登录</button>
        </form>
    </div>
    <script src="~/Lib/jquery-1.10.2.min.js"></script>
    <script src="~/Lib/jquery.form.js"></script>
    <script src="~/layui/layui.js"></script>
    <script>
        $(function () {
            var singleLogin = function (url, params) {
                $.ajax({  
                    url: url,  
                    dataType: 'jsonp',  
                    async:false,
                    data: params,  
                    jsonp:'callback'
                });  
            }

            layui.use(['form'], function () {
                var form = layui.form, layer = layui.layer, $ = layui.$;
                //监听提交
                form.on('submit(btn_login)',
                    function () {
                        $("#login-form").ajaxSubmit(function (result) {
                            if (result.success) {
                                window.location.href = '/Home/Index';
                            }
                            else
                                layer.msg(result.message);
                        });
                        return false;
                    });
            });
        })

    </script>
</body>